<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    function parseHTML(strhtml){
        var arr = [];
        var divTag = document.createElement('div');
        divTag.innerHTML = strhtml;
        arr.push.apply(arr,divTag.childNodes)//子节点push到数组里
        return arr;
    }
    //遍历这个数组 增加样式
  
     var data = [
    {name: 'jim1', age: 19, gender: '男'},
    {name: 'jim2', age: 9, gender: '女'},
    {name: 'jim3', age: 29, gender: '男还是女'},
    {name: 'jim4', age: 39, gender: '女'},
    {name: 'jim5', age: 49, gender: '不男还是不女'}
 ];
    var temp = data.map(function(item,index){
        var arr = [];
        for(var key in item){
            arr.push('<td>'+item[key]+'</td>')
        }
        return '<tr>'+arr.join('')+'</tr>'
    })
    temp = '<table border="1" width="400">'+temp.join('')+'</table>'
    parseHTML(temp).forEach(function(item,index){
        document.body.appendChild(item);
    })
</script>
</html>